<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>班级信息</title>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="../../css/font.css">
    <link rel="stylesheet" href="../../css/login.css">
	  <link rel="stylesheet" href="../../css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="../../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a><cite>导航元素</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                        
                            <table class="layui-table layui-form" id="test" lay-filter="test"></table>
                            
                        </div>
                    </div>
                </div>
            </div>
        </div> 
</body>
<script>
    	layui.use([ 'table','form', 'layer','layedit', 'laydate' ], function(){
    	  $ = layui.jquery;
  		  var table = layui.table;
  		  var form = layui.form,layer = layui.layer;
  		  
  		  //第一个实例
  		  table.render({
  		    elem: '#test'
  		    ,id:"tableDataId"
  		    //请求的媒体类型
  		    ,url: '/../AdvertisementApplication/findAdvertisementApplicationList' //数据接口
  		    ,cols: [[ //表头
  		    /* cols 绑定数据行列的， field对于的实体类属性名 ，title 列名 ，是否sort排序*/
  		      {field: 'aaId', title: '编号'}
  		      ,{field: 'aaName', title: '联系人'}
  		      ,{field: 'aaPhone', title: '联系电话'}
  		      ,{field: 'aaCreateTime', title: '申请时间'}
  		      ,{field : '',title : '操作',toolbar : '#barDemo'}
  		    ]] 
  		  	,page: true //开启分页
  		    ,limit: 5 // 一页多少条
  		    ,limits:[5,10,15,20]  // 数据分页条
  		  });
  		  
  		table.on('tool(test)', function(obj) {
  			var data = obj.data;
  			if (obj.event === 'del') {
  				layer.confirm('真的删除行么', function(index) {
  					$.ajax({
  			            type : "POST",
  			            url : "/../AdvertisementApplication/deleteAdvertisementApplication",
  			            data : {"aaId":data.aaId},
  			            success : function(result) {
  			            	if(result>0){
  								layer.alert("删除成功", {
  									icon : 6
  								});
  								obj.del();
  		      					layer.close(index);
  			            	}else{
  								layer.alert("删除失败！", {
  									icon : 6
  								});
  			            	}
  			            }
  			        });
  				});
  			}
  		});
  		  
    	});
    </script>
   <script type="text/html" id="barDemo">
 			<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>
    
</html>